package com.pet.behavior.controller;


import com.pet.behavior.service.ApBehaviorEntryService;
import com.pet.common.controller.AbstractController;
import com.pet.model.behavior.pojos.ApBehaviorEntry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
* <p>
* APP行为实体表</p>
*/
@RestController
@RequestMapping("/api/behaviorEntry")
public class ApBehaviorEntryController extends AbstractController<ApBehaviorEntry>{

    private ApBehaviorEntryService apBehaviorEntryService;

    //注入
    @Autowired
    public ApBehaviorEntryController(ApBehaviorEntryService apBehaviorEntryService) {
        super(apBehaviorEntryService);
        this.apBehaviorEntryService=apBehaviorEntryService;
    }

    @RequestMapping("findByUserIdOrEquipmentId")
    public ApBehaviorEntry findByUserIdOrEquipmentId(@RequestParam(value = "userId",required = false)Integer userId,@RequestParam(value = "equipmentId",required = false) Integer equipmentId){
        return apBehaviorEntryService.findByUserIdOrEquipmentId(userId,equipmentId);
    }

    @RequestMapping("save")
    public boolean save(@RequestParam(value = "userId",required = false)Integer userId,@RequestParam(value = "equipmentId",required = false) Integer equipmentId){
        return apBehaviorEntryService.save(userId,equipmentId);
    }
}

